Typical use for names2dos is in porting software from a Unix system to MS-DOS. A copy of the source code directory tree is made under Unix, then names2dos is run on the copied tree. The converted directory tree is then ``bundled up'' with tar, arc, zip, etc., and downloaded to the MS-DOS system.
The script will only work on file and directory names in the named subdirectory. If the command:
names2dos NFSmt_point/Sys_Type.SUN4/src.local/groff.1.0.7
is given, only the directory name groff.1.0.7 and any files or directories that it contains will be changed, even though all the other directory names in the path are not DOS compatible.
Any characters that are invalid for MS-DOS filenames are replaced with a dash (hyphen). The script attempts to deal with unusual filenames, including those containing <SPACE>, *, ?, (, ), [, ], and <QUOTE> characters.
Hidden (``dot'') files have the initial period changed to an underline.
Files who's names end with a trailing period have an underline appended to their name. This is because MS-DOS doesn't distinguish between filename and filename. .
Filenames are shortened and components of filenames (separated by periods) may be combined. The file and directory names are checked to be unique after they are created. If a non-unique filename is generated, the last character in the base section is changed in an attempt to make the filename unique.
Once all changes are made to directory and file names, names2dos checks each file in the directory tree for references to file names that have been changed. The contents of these files are altered to refer to the re-named files.
/dev/null rh /dev/nul /dev/tty rh /dev/con
The log file, changes.log, is a verbose log of the changes made to the directory tree. This is placed in the current directory and will silently over-write any existing file of the same name.
Converted filenames:
UNIX Name MS-DOS Name joe joe josephTsmith josepht primes+squares.c primes_s.c Makefile.toplevel.Patch.16 makefile.16 font.postscript.Helvetica font_pos.hel base.1.2.3.extension base_1_2.ext PostScript.font.viewer.cc postscri.cc
If a unique name cannot be created a warning is added to the log file.
For example, if the directory to convert to MS-DOS naming
standards contains the ``C'' source file named:
build.fonts.c
this would be re-named:
build_fo.c
and all references to build.fonts.c would be correctly
changed within files.
However, a makefile might very well depend on the
executable
version---named build.fonts.
This name would not be changed, and any attempts to run
build.fonts (silently truncated by MS-DOS to
build.fo) would fail.
No attempt is made to change references within files to directory names that have been converted. This change would be very difficulty, due to the iterative method for changing directory names, and probably is not needed very often.
The script will probably fail hard on filenames with 8-bit characters.
Errors from sed complaining about ``Too much command text'' indicate a need for GNU sed.
There is also a limit of 41 character substitutions that will be made in an attempt to generate a unique filename.
names2dos version: 2.1 1993/04/13 04:01:33 bergman names2dos awk script version: 2.0 1993/04/11 23:36:01 bergman